package com.tonann.app.service.impl;

import com.tonann.app.domain.AppFaultGateway;
import com.tonann.app.mapper.AppFaultGatewayMapper;
import com.tonann.app.service.IAppFaultGatewayService;
import com.tonann.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 网关故障Service业务层处理
 *
 * @author tonann
 * @date 2022-10-15
 */
@Service
public class AppFaultGatewayServiceImpl implements IAppFaultGatewayService {
    @Autowired
    private AppFaultGatewayMapper appFaultGatewayMapper;


//    private MqttConfig mqttConfig = new MqttConfig();

    /**
     * 查询网关故障
     *
     * @param faultId 网关故障主键
     * @return 网关故障
     */
    @Override
    public AppFaultGateway selectAppFaultGatewayByFaultId(Long faultId) {
        return appFaultGatewayMapper.selectAppFaultGatewayByFaultId(faultId);
    }

    /**
     * 查询网关故障列表
     * 
     * @param appFaultGateway 网关故障
     * @return 网关故障
     */
    @Override
    public List<AppFaultGateway> selectAppFaultGatewayList(AppFaultGateway appFaultGateway)
    {
        return appFaultGatewayMapper.selectAppFaultGatewayList(appFaultGateway);
    }

    /**
     * 新增网关故障
     * 
     * @param appFaultGateway 网关故障
     * @return 结果
     */
    @Override
    public int insertAppFaultGateway(AppFaultGateway appFaultGateway)
    {
//        mqttConfig.inbound();
        appFaultGateway.setCreateTime(DateUtils.getNowDate());
        return appFaultGatewayMapper.insertAppFaultGateway(appFaultGateway);
    }

    /**
     * 修改网关故障
     * 
     * @param appFaultGateway 网关故障
     * @return 结果
     */
    @Override
    public int updateAppFaultGateway(AppFaultGateway appFaultGateway)
    {
        appFaultGateway.setUpdateTime(DateUtils.getNowDate());
        return appFaultGatewayMapper.updateAppFaultGateway(appFaultGateway);
    }

    /**
     * 批量删除网关故障
     * 
     * @param faultIds 需要删除的网关故障主键
     * @return 结果
     */
    @Override
    public int deleteAppFaultGatewayByFaultIds(Long[] faultIds)
    {
        return appFaultGatewayMapper.deleteAppFaultGatewayByFaultIds(faultIds);
    }

    /**
     * 删除网关故障信息
     * 
     * @param faultId 网关故障主键
     * @return 结果
     */
    @Override
    public int deleteAppFaultGatewayByFaultId(Long faultId)
    {
        return appFaultGatewayMapper.deleteAppFaultGatewayByFaultId(faultId);
    }
}
